﻿<phone:PhoneApplicationPage
    x:Class="HAP.WP.MyFiles.Browser"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:HAP.WP.MyFiles"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="White"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True" BorderBrush="#FF004577" Background="#FF004577">

    <!--Data context is set to sample data above and LayoutRoot contains the root grid where all other page content is placed-->
    <Grid x:Name="LayoutRoot" Background="#FF004577">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <ProgressBar Name="loading" Foreground="White" IsIndeterminate="True" />
        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="1" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="Home Access Plus+ My Files" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="Loading..." Margin="9,-7,0,0" FontSize="50"/>
        </StackPanel>

        <!--ContentPanel contains ListBox and ListBox ItemTemplate. Place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="2" Margin="12,0,12,0">
            <ListBox x:Name="DriveListBox" Margin="0,0,-12,0" ItemsSource="{Binding}" SelectionMode="Single" SelectionChanged="DriveListBox_SelectionChanged">
                <ListBox.Resources>
                    <ResourceDictionary>
                        <local:SpaceValueConverter x:Key="SpaceValueConverter"/>
                        <local:PrefixValueConverter x:Key="PrefixValueConverter" />
                    </ResourceDictionary>
                </ListBox.Resources>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                      <StackPanel Margin="0,0,0,17" Orientation="Horizontal">
                            <TextBlock Text="{Binding Path, Converter={StaticResource ResourceKey=PrefixValueConverter}, ConverterParameter=1}" FontSize="80" />
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="{Binding Name}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                                <ProgressBar Value="{Binding Space, Converter={StaticResource ResourceKey=SpaceValueConverter}}" />
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <ListBox x:Name="MainListBox" Margin="0,0,-12,0" ItemsSource="{Binding}" SelectionMode="Single" SelectionChanged="MainListBox_SelectionChanged">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0,0,0,17" Orientation="Horizontal">
                            <StackPanel.Resources>
                                <ResourceDictionary>
                                    <local:ImageUriConverter x:Key="ImageUriConverter" />
                                </ResourceDictionary>
                            </StackPanel.Resources>
                            <Image Source="{Binding Icon, Converter={StaticResource ResourceKey=ImageUriConverter}}" Width="70" Stretch="None" HorizontalAlignment="Left" />
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <TextBlock Text="{Binding Name}" FontSize="24" TextWrapping="Wrap"/>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Type}" FontSize="16"/>
                                    <TextBlock Text="{Binding Size, StringFormat=' {0}'}" FontSize="16" />
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>
 
</phone:PhoneApplicationPage>